<form
name="register"
action=""
onSubmit = "return validate()"
method="get">

<label><input type="checkbox" name="hobbies[]" value="c" />Cricket</label>
<label><input type="checkbox" name="hobbies[]" value="h" />Hockey</label>
<label><input type="checkbox" name="hobbies[]"  />Badminton</label>
<label><input type="checkbox" name="hobbies[]" value="f" />Football</label>
<label><input type="checkbox" name="hobbies[]" value="p" />Poker</label>

  <input type="submit" value="Please Submit!!" />
</form>
<script type="text/javascript">
  function validate(){
    var count = 0;
    var minCheck = 3;
    var oHobbies = document.getElementsByName('hobbies[]');
    console.log(oHobbies.length);
    var flag = false;
    for (var i = 0; i < oHobbies.length; i++)
    {
      if(oHobbies[i].checked){
        count++;
      }
    }
    if(count < minCheck) {
      alert("Please select "+minCheck+" hobbies");
      return false;
    }
    return true;
  }
</script>
